package com.iting.xmldemo.factorybeandemo;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author iting Nie
 * @version 1.1
 * @create 2021/12/11
 */
public class Car implements InitializingBean, DisposableBean {
	private String name;
	private String price;
	private String description;

	public Car(String name, String price) {
		this.name = name;
		this.price = price;
	}

	public Car() {
	}

	public void add(){
		// System.out.println("Car中的add方法执行了");
	}

	@Override
	public String toString() {
		return "Car{" +
				"name='" + name + '\'' +
				", price='" + price + '\'' +
				", description='" + description + '\'' +
				'}';
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("Car的afterPropertiesSet方法执行了");
		description = name + price + "元抵用券";
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	@Override
	public void destroy() throws Exception {
		System.out.println("Car的destroy");
	}
}
